package com.application.attachment.service;

import java.util.List;

import com.manager.BaseService;
import com.manager.commons.page.PageBean;
import com.application.attachment.entity.Attachment;
import com.application.attachment.struts.form.AttachmentForm;
import com.application.attachment.dao.AttachmentDAO;
public class AttachmentService extends BaseService {
	private AttachmentDAO attachmentDAO;

	public AttachmentDAO getAttachmentDAO() {
		return this.attachmentDAO;
	}

	public void setAttachmentDAO(AttachmentDAO attachmentDAO) {
		this.attachmentDAO = attachmentDAO;
	}

	public Attachment getAttachment(Attachment attachment) {
		return (Attachment) this.getBaseDao().queryByPk(attachment, attachment.getId());
	}

	public Integer getAllCountAttachment(AttachmentForm attachmentForm) {
		return this.attachmentDAO.getAllCountAttachment(attachmentForm);
	}

	public List<Attachment> searchAttachment(AttachmentForm attachmentForm, PageBean pageBean) throws Exception {
		List<Attachment> attachmentList = (List) this.attachmentDAO.searchAttachment(attachmentForm, pageBean);
		return attachmentList;
	}

	public void deleteAttachments(AttachmentForm attachmentForm) {
		this.attachmentDAO.deleteAttachments(attachmentForm);
	}

	public List queryAttachment(AttachmentForm attachmentForm) {
		return attachmentDAO.queryAttachment(attachmentForm);
	}
	 public void updateFileNum(String id,Long num){
		 attachmentDAO.updateFileNum(id,num);
	 }
	 public int getFileNumCount(String id){
		 return attachmentDAO.getFileNumCount(id);
	 }
}
